﻿<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
    <head>
        <meta charset="utf-8">
        <title>修改权限</title>
        <base th:href="@{/}"/>
        <meta name="renderer" content="webkit">
        <meta http-equiv="Cache-Control" content="no-cache"/>
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="format-detection" content="telephone=no">
        <link rel="stylesheet" href="static/css/x-admin.css" media="all">
        <link rel="stylesheet" href="static/css/backstage.css" media="all">
        
        <script src="static/js/jquery.min.js"></script>
        <script>

	        
	        /*根据传过来的id 取得管理员信息并回显*/
	    	$(function(){
	    		   var id=window.location.search.split("=")[1];
	    		   alert(id)
	    			$.ajax({
	    				url:"admin/searchAuths",
	    				type:"get",
	    				data:{id:id},
	    				dataType:"json",
	    				success:function(data){
	    					var auth=data.t;
	    					window.alert(JSON.stringify(data.t))
	    					$("#id").val(auth.id);
	    					$("#authName").val(auth.authName);
	    					$("#authLabel").val(auth.authLabel);
	    					$("#content").val(auth.content);
                            $("#type").val(auth.type);
	    				}
	    				
	    			})
	    	});
	         function deleteAuth(){
	        	 if(confirm("确定提交吗")==true){
	        		 $.ajax({
	 	    			url:"admin/Authupdate",
	 	    			type:"post",
                         // contentType:"application/json;charset=UTF-8",
	 	    			data:{
	 	    				id:$("#id").val(),
	 	    				authName:$("#authName").val(),
	 	    				authLabel:$("#authLabel").val(),
	 	    				content:$("#content").val(),
                            type:$("#type").val()
	 	    			},
	 	    			dataType:"json",
	 	    			success:function(data){
	 	    				alert(data.message);
	 	    				window.location.href="admin/auth";
	 	    			}
	 	    			
	 	    		});
	        	 }
	    	}
        </script>
        

    </head>
    
    <body>
    <div class="wrap">
        <div class="x-nav">
            <div class="title">
              <a><cite>系统设置 >>修改权限信息</cite></a>
              <a  class="back" href="system.html">返回上页</a>
              </div>         
        </div>
        <div class="x-body">
          <form action="" class="fom">
          	<div class="adduser clearfix">
                  <div class="adminimg"> <img src="static/images/admin.png" ></div>
                   <div class="inputright">
                       <p>
                           <input id="id" type="hidden" >
                       </p>
                       <p>
                        <label>标题</label>
                        <input id="authName"  class="lg" >
                       </p>
                      <p>
                        <label>标签</label>
                        <input id="authLabel" class="lg"  readonly>
                      </p>
                     <p>
                        <label>备注</label>
                        <input id="content" class="lg">
                     </p>
                       <p>
                           <label>类型</label>
                           <input id="type" class="lg">
                       </p>
                       <p>
                        <input id="btnAdd" type="button" value="提交" class="btn" onclick="deleteAuth()">
                       </p>
                   </div>
			</div>            
          </form>             
    	</div>
    </div>
    </body>

</html>